//
//  GHPartnerCollectionViewCell.m
//  GodHorses
//
//  Created by Mac on 2017/11/17.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "GHPartnerCollectionViewCell.h"
#define imageWith (UIScreenWidth / 2 - 15)
@interface GHPartnerCollectionViewCell()
@property(nonatomic, strong) UIImageView     *iconImageView;
@property(nonatomic, strong) STLabel         *titleLable;
@property(nonatomic, strong) STLabel         *nameLable;//name 和手机号
@property(nonatomic, strong) STLabel         *phoneLable;
@property(nonatomic, strong) STLabel         *addressLable;
@end
@implementation GHPartnerCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 270;
}
#pragma mark --SubView
- (void)configSubView{
    self.backgroundColor = GH_backgroundColor;
    UIView * whiteView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth / 2 - 15, [GHPartnerCollectionViewCell cellHeight] - 10)];
    whiteView.backgroundColor = [UIColor whiteColor];
    whiteView.layer.cornerRadius = 5;
    whiteView.clipsToBounds = YES;
    [self addSubview:whiteView];
    
    self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, imageWith, 200)];
    self.iconImageView.image = [UIImage imageNamed:@"01"];
   // [self.iconImageView st_showBottomLineAndWitdh:self.iconImageView.st_width - 20];
    self.iconImageView.backgroundColor = [UIColor whiteColor];
    [whiteView addSubview:self.iconImageView];
    
    self.titleLable = [[STLabel alloc] initWithFrame:CGRectMake(10, self.iconImageView.st_bottom + 1, imageWith - 20, 20)
                                                text:@"------"
                                           textColor:GH_firstTextColor
                                                font:15
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    self.titleLable.numberOfLines = 0;
    [whiteView addSubview:self.titleLable];
    

    self.nameLable = [[STLabel alloc] initWithFrame:CGRectMake(10, self.titleLable.st_bottom + 1, imageWith/3 - 10, 15)
                                                text:@"---      -------"
                                           textColor:GH_secendTextColor
                                                font:13
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    self.titleLable.numberOfLines = 0;
    [whiteView addSubview:self.nameLable];
    
    self.phoneLable = [[STLabel alloc] initWithFrame:CGRectMake(10, self.titleLable.st_bottom + 1, 2 *imageWith/3 - 10, 15)
                                               text:@"---      -------"
                                          textColor:GH_secendTextColor
                                               font:13
                                        isSizetoFit:NO
                                      textAlignment:NSTextAlignmentRight];
    self.phoneLable.st_right = whiteView.st_width - 10;
    [whiteView addSubview:self.phoneLable];
    
    self.addressLable = [[STLabel alloc] initWithFrame:CGRectMake(10, self.nameLable.st_bottom + 1, imageWith - 20, 15)
                                               text:@"---      -------"
                                          textColor:GH_secendTextColor
                                               font:13
                                        isSizetoFit:NO
                                      textAlignment:NSTextAlignmentLeft];
    [whiteView addSubview:self.addressLable];
    
}
- (void)setModel:(GHParterModel *)model{
    _model = model;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:self.model.logo]
                          placeholderImage:GH_placeHoderImage];
    self.titleLable.text = model.shop_name;
    self.nameLable.text = model.name;
    self.phoneLable.text = model.shop_phone;
    self.addressLable.text = [NSString stringWithFormat:@"%@%@%@",model.addr_s,model.addr_c,model.addr_d];
}
@end
